<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('我的复盘')" />
    <link rel="stylesheet" href="/css/jquery.dataTable.css">
    <style>
        .up-text{
            color: red;
        }
        .down-text{
             color: #1abb94;
         }
        .image {
            position: absolute;
            top: -100%; /* 将图片移动到容器的上方，避免影响到表格 */
            left: -100%; /* 将图片移动到容器的左侧，避免影响到表格 */
            opacity: 0.8;
            background-color: white;
            /*transition: opacity 0.7s ease;*/
            z-index: 1000;
        }
    </style>
</head>

<body class="gray-bg">
    <div class="row animated fadeInRight">
        <div class="float-e-margins">
            <div id="ibox-content">
                <div id="vertical-timeline" class="vertical-container light-timeline">
                    <div class="vertical-timeline-block">
                        <div class="vertical-timeline-icon yellow-bg">
                            <i class="fa fa-line-chart"></i>
                        </div>

                        <div class="vertical-timeline-content">
                            <h2>大盘</h2>
                            <div class="col-md-6">
                                <div class="col-md-4">上证：<span  th:text="${daily_basic_fp.szzs}" th:class="${daily_basic_fp.szzs} > 0?'up-text':'down-text'"></span></div>
                                <div class="col-md-4"> 创指：<span th:text="${daily_basic_fp.szcz}" th:class="${daily_basic_fp.szcz} > 0?'up-text':'down-text'"></span>  </div>
                                <div class="col-md-4"> 北证：<span th:text="${daily_basic_fp.bz50}" th:class="${daily_basic_fp.bz50} > 0?'up-text':'down-text'"></span></div>

                                <div class="col-md-4"> 北向：<span  th:text="${#numbers.formatInteger(daily_report.hk/10000,0)}" th:class="${daily_report.hk} > 0?'up-text':'down-text'"></span></div>
                                <div class="col-md-4"> 总成交量：<span th:text="${daily_basic_fp.hs_money/10000}" th:class="${daily_basic_fp.hs_money} > 1000000000?'up-text' "></span></div>
                                <div class="col-md-4"> 北京成交量：<span th:text="${daily_basic_fp.bj_money/10000}" th:class="${daily_basic_fp.bj_money} > 1000000?'up-text' "></span></div>

                                <div class="col-md-4"> 涨停：<span  th:text="${daily_report.zt_count}" th:class="${daily_report.zt_count} > 70?'up-text'"></span></div>
                                <div class="col-md-4"> 跌停：<span  th:text="${daily_report.dt_count}" th:class="${daily_report.dt_count} >30 ?'down-text'"></span></div>
                                <div class="col-md-4"> 涨家数：<span  th:text="${daily_report.upcount}" th:class="${daily_report.upcount} < 1000?'down-text'"></span></div>

                                <!--   <span class="vertical-date">-->
<!--                                今天 <br>-->
<!--                             <small>2月3日</small>-->
<!--                            </span>-->
                            </div>
<!--                            <div class="col-md-6">-->
<!--                                <p id="basic-conclusion"> 大盘上涨后第一次回调，应该有人会抄底</p>-->

<!--                            </div>-->
<!--                            <a href="#" class="btn btn-sm btn-warning"> 结论</a>-->
                        </div>
                    </div>

                    <div class="vertical-timeline-block">
                        <div class="vertical-timeline-icon blue-bg">
                            <i class="fa fa-file-text"></i>
                        </div>

                        <div class="vertical-timeline-content">
                            <h2>强势板块</h2>
                            <table class="table table-hover no-margins" >
                                <thead>
                                <tr>
                                    <th style="width:70px">板块</th>
                                    <th style="width:50px">类型</th>
                                    <th>股票</th>
                                    <th style="width:80px">阶段</th>
                                    <th>备注</th>
                                </tr>
                                </thead>
                                <tbody id="hot-concept-body">

                                </tbody>
                            </table>
<!--                            <span class="vertical-date">-->
<!--                                <br><br>-->
<!--                              <small style="color: red"><i class="fa fa-exclamation-circle"></i>重点观察板块、个股需要标颜色</small>-->
<!--                         </span>-->
                        </div>
                    </div>

                    <div class="vertical-timeline-block">
                        <div class="vertical-timeline-icon red-bg">
                            <i class="fa  fa-sort-numeric-asc"></i>
                        </div>

                        <div class="vertical-timeline-content">
                            <h2>连板</h2>
                            <img class="image" src=''  style='display: none;'>
                            <table id="bootstrap-table"></table>
<!--                            <a href="#" class="btn btn-sm btn-info">更多</a>-->
<!--                            <span class="vertical-date"> 昨天 <br><small>2月2日</small></span>-->
                        </div>
                    </div>

                    <div class="vertical-timeline-block">
                        <div class="vertical-timeline-icon yellow-bg">
                            <i class="fa fa-phone"></i>
                        </div>

                        <div class="vertical-timeline-content">
                            <h2>涨停分类</h2>
                            <table id="example4">
                                <thead>
                                <tr>
                                    <th>股票名称</th>
                                    <th>连板数</th>
                                    <th>概念</th>
                                    <th>理由</th>
                                    <th>个数</th>
                                    <th>封板</th>
                                    <th>成交额</th>
                                </tr>
                                </thead>
                                <tbody>


                                </tbody>
                            </table>
                        </div>
                    </div>

                    <div class="vertical-timeline-block">
                        <div class="vertical-timeline-icon lazur-bg">
                            <i class="fa fa-user-md"></i>
                        </div>

                        <div class="vertical-timeline-content">
                            <h2>龙虎榜/机构跟踪</h2>
                            <p>席位数+1的 1 代表 龙虎榜上的北上资金； 注意！假机构没有做区别！</p>
                            <table id="lhb-jg-table"></table>
                        </div>
                    </div>
                    <div class="vertical-timeline-block">
                        <div class="vertical-timeline-icon lazur-bg">
                            <i class="fa fa-user-md"></i>
                        </div>

                        <div class="vertical-timeline-content">
                            <h2>龙虎榜/疑似量化跟踪</h2>
                            <p>如有疑似量化席位的推荐，请留言或者私信我； 碰上疑似的量化席位，默认机构为假机构，需要读者自行区分</p>
                            <table id="lhb-lh-table"></table>
                        </div>
                    </div>
                    <div class="vertical-timeline-block">
                        <div class="vertical-timeline-icon lazur-bg">
                            <i class="fa fa-user-md"></i>
                        </div>

                        <div class="vertical-timeline-content">
                            <h2>龙虎榜/ 重要席位 跟踪</h2>
                            <p>正在考虑哪些席位，如有推荐，请留言或者私信我；</p>
<!--                            <table id="lhb-lh-table"></table>-->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="/js/jquery.dataTables.min.js"></script>
    <script src="/js/html2canvas.min.js"></script>
    <script th:inline="javascript">
        var lbs =[[${lbs}]]
        var daily_bk =[[${daily_bk}]]
        var hotConceptStocks=[[${hotConceptStocks}]]
        var today =[[${today}]]
        // console.log(lbs)

        var options = {
            id:"bootstrap-table",
            data: [[${lbs}]],
            pagination:false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [
                {
                    field : 'name',
                    title : '名称',
                    formatter: function(value, row, index) {
                        if(row.symbol.startsWith('3')){
                            value =  value+"-创";
                        }
                        if(row.symbol.startsWith('68')) {
                            value =  value+"-科";
                        }
                        if(row.symbol.startsWith('6')) {
                            value =  "<span class='lb-show-img' symbol='sh"+row.symbol+"'>"+value+"</span> ";
                        }
                        if(row.symbol.startsWith('0')||row.symbol.startsWith('3')) {
                            value =  "<span class='lb-show-img' symbol='sz"+row.symbol+"'>"+value+"</span> ";
                        }
                        return value;
                    }
                },
                {
                    field : 'tradeMoney',
                    title : '成交额',
                    formatter: function(value, row, index) {
                        return (value/100000000).toFixed(1);
                    }
                },
                {
                    field : 'turnoverRate',
                    title : '换手率',
                    formatter: function(value, row, index) {
                        return (value/1).toFixed(1);
                    }
                },
                {
                    field : 'circulatedValue',
                    title : '流通值',
                    formatter: function(value, row, index) {
                        return (value/100000000).toFixed(0);
                    }
                },
                {
                    field : 'limitTimes',
                    title : '连板'
                },
                {
                    field : 'reason',
                    title : '涨停理由'
                },
                {
                    field : 'type',
                    title : '涨停类型',
                    formatter: function(value, row, index) {
                        if(value == 1){
                            return "一字"
                        }
                        return '';
                    }
                }
                ]
        };
        $.table.init(options);
        $('.lb-show-img').mouseenter(function(e) {
            $(".image").attr("src","https://image.sinajs.cn/newchart/daily/n/"+$(this).attr('symbol')+".gif")
            var posX = e.pageX - $(this).offset().left;
            var posY = e.pageY - $(this).offset().top;
            // $(this).find('.image').css({'top': posY, 'left': posX});
            $(".image").css({'top': posY, 'left': posX});
            $(".image").show();
        }).mouseleave(function() {
            $(".image").hide();
        });

        freshTable()
        function freshTable(){
            $("#hot-concept-body").empty();
            for(var i in daily_bk ){
                appendOne(daily_bk[i])
            }
        }

        function appendOne(showRecentConceptStock){
            var main_stocks="";
            // var trend="";
            var lb="";
            // var taoli="";
            var other="";
            var data = showRecentConceptStock["data"];
            data = JSON.parse(data);
            // console.log(data)
            for(var i in data["main_stock"]){
                main_stocks = main_stocks+'<span class="label label-success">'+data["main_stock"][i]+'</span> '
            }
            // for(var i in data["trend"]){
            //     trend = trend+'<span class="label label-success">'+data["trend"][i]+'</span> '
            // }
            for(var i in data["lb"]){
                lb = lb+'<span class="label label-success">'+data["lb"][i]+'</span> '
            }
            // for(var i in data["taoli"]){
            //     taoli = taoli+'<span class="label label-success">'+data["taoli"][i]+'</span> '
            // }
            for(var i in data["other"]){
                other = other+'<span class="label label-success">'+data["other"][i]+'</span> '
            }
            var needAppend = "<tr><td rowspan=\"3\"><span class=\"label label-danger\">"+showRecentConceptStock["name"]+"</span></td>"+
                "<td> <span class=\"label label-danger\">核心</span></td> <td style='line-height: 1.7;'>"+main_stocks+" </td>"+
                "<td rowspan=\"3\">"+data["jieduan"]+"</td>"+
                "<td rowspan=\"3\">"+data["comment"]+"</td>"+
                "</tr>";
            // needAppend=needAppend+"<tr><td> <span class=\"label label-primary\">趋势</span></td> "+
            //     "<td style='line-height: 1.7;'>"+trend+" </td></tr>";
            needAppend=needAppend+"<tr><td> <span class=\"label label-warning\">连板</span></td> "+
                "<td style='line-height: 1.7;'>"+lb+" </td></tr>";
            // needAppend=needAppend+"<tr><td> <span class=\"label label-primary\">套利</span></td> "+
            //     "<td style='line-height: 1.7;'>"+taoli+" </td></tr>";
            needAppend=needAppend+"<tr><td> <span class=\"label label-default\">其他</span></td> "+
                "<td style='line-height: 1.7;'>"+other+" </td></tr>";
            $("#hot-concept-body").append(needAppend)
        }



        var conceptTable = $('#example4').DataTable({
            "paging": false,
            "lengthChange": false,
            "searching": false,
            "ordering": true,
            "info": false,
            "autoWidth": false,
            "responsive": true,
            "data": hotConceptStocks,
            "columns": [
                { "data": "n" },
                { "data": "l"},
                { "data": "h" },
                { "data": "c" },
                { "data": "num" },
                { "data":"lt"},
                { "data": "b" },

                // { "data":"cv"},
            ],
            "columnDefs": [
                { "visible": false, "targets": 4 },
                { "visible": false, "targets": 2 }
            ],
            // "order": [ 4, 'desc' ],
            // "displayLength": 25,
            "drawCallback": function ( settings ) {
                var api = this.api();
                var rows = api.rows( {page:1}).nodes();
                var last=null;

                api.column(2,{page:1}).data().each( function ( group, i ) {
                    if ( last !== group ) {
                        $(rows).eq( i ).before(
                            '<tr class="group"><td colspan="6" style="font-weight: bold;font-size: 15px;color: red">'+group+'</td></tr>'
                        );

                        last = group;
                    }
                } );
            }
        } );

        conceptTable.order( [ 4, "desc" ],[ 2, "desc" ],[ 1, "desc" ],[ 5, "asc" ] ).draw();


        var lhb_jg_options = {
            id:"lhb-jg-table",
            url:  "/lhb/jg/list?tradeDate="+today,
            modalName: "jg席位",
            pagination:false,
            columns: [
                {
                    field: 'stockCode',
                    title: '代码'
                },
                {
                    field: 'stockName',
                    title: '名称',
                    formatter: function(value, row, index) {
                        return '<a target="_blank" href="https://data.eastmoney.com/stock/lhb/'+row['stockCode']+'.html">'+value+'</a> '
                    }
                },
                {
                    field: 'buyCount',
                    title: '买入席位数'
                },
                {
                    field: 'sellCount',
                    title: '卖出席位数'
                },
                {
                    field: 'jBuyValue',
                    title: '机构买入'
                },
                {
                    field: 'jSellValue',
                    title: '机构卖出'
                },
                {
                    field: 'jBuyNet',
                    title: '机构净买入'
                },
                {
                    field: 'gBuyValue',
                    title: '港资买入'
                },
                {
                    field: 'gSellValue',
                    title: '港资卖出'
                },
                {
                    field: 'gBuyNet',
                    title: '港资净买入'
                },

                {
                    field: 'type',
                    title: '单日/三日',
                    formatter: function(value, row, index) {
                        if(value ==3){
                            return value;
                        }
                    }
                }]
        };
        $.table.init(lhb_jg_options);

        var lhb_lh_options = {
            id:"lhb-lh-table",
            pagination:false,
            url:  "/lhb/lhxw/list?tradeDate="+today,
            modalName: "量化席位",
            columns: [
                {
                    field: 'stockCode',
                    title: '代码'
                },
                {
                    field: 'stockName',
                    title: '名称',
                    formatter: function(value, row, index) {
                        return '<a target="_blank" href="https://data.eastmoney.com/stock/lhb/'+row['stockCode']+'.html">'+value+'</a> '
                    }
                },
                {
                    field: 'buyCount',
                    title: '买入席位数'
                },
                {
                    field: 'sellCount',
                    title: '卖出席位数'
                },
                {
                    field: 'buyValue',
                    title: '买入'
                },
                {
                    field: 'sellValue',
                    title: '卖出'
                },
                {
                    field: 'buyNet',
                    title: '净买入'
                },
                {
                    field: 'volValue',
                    title: '交易额',
                    formatter: function(value, row, index) {
                            return (value/100000000).toFixed(2);
                    }
                },
                {
                    field: 'percent',
                    title: '买入比例',
                    formatter: function(value, row, index) {
                        if(value >10){
                            return '<span style="color:red">'+value.toFixed(1)+'</span>';
                        }else{
                            return value.toFixed(1);
                        }
                    }
                },
                {
                    field: 'type',
                    title: '单日/三日',
                    formatter: function(value, row, index) {
                        if(value ==3){
                            return value;
                        }
                    }
                }]
        };
        $.table.init(lhb_lh_options);



    </script>
</body>
</html>
